package com.isi.mtl.lf.ex3.actions;

import java.util.ArrayList;

import javax.faces.model.SelectItem;

import com.isi.mtl.lf.ex3.entites.Modele;
import com.isi.mtl.lf.ex3.managers.ModeleManager;

public class ListeModeleAction {

	public static ArrayList<SelectItem> getListeModeleItem(int marqueId) {
		
		System.out.println("getListeModeleItem(int marqueId)");
		
		System.out.println("getListeModeleItem(int marqueId) ");
		ArrayList<SelectItem> alSi = new ArrayList<SelectItem>();
		ArrayList<Modele> alModeles = ModeleManager.getModeleByIdMarque(marqueId);
		
		for(Modele m : alModeles) {
			System.out.println("ListeModeleAction "+m);
			System.out.println("ListeModeleAction id marque : "+m.getIdMarque());
			System.out.println("ListeModeleAction desc modele : "+m.getDescModele());
			System.out.println("ListeModeleAction Id modele : "+m.getIdModele());
			alSi.add(new SelectItem(m.getIdMarque(), m.getDescModele()));
		}
		
		return alSi;
		
	}
	//***je suis une modification
	public static Modele getDetailModele(int modeleId){
		Modele m;
		m = ModeleManager.getModeleByModeleId(modeleId);
		return m;
	}
	
}
